{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "849106c9-185f-4868-8aeb-d5061a91db1b",
   "metadata": {},
   "source": [
    "Chapter 07\n",
    "# 用if判断是否成绩及格，三层判断\n",
    "Book_1《编程不难》 | 鸢尾花书：从加减乘除到机器学习 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "12ed7ec7-28f4-44e3-bb07-229c0d140aad",
   "metadata": {},
   "outputs": [
    {
     "name": "stdin",
     "output_type": "stream",
     "text": [
      "请输入一个数值:  88\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "及格\n"
     ]
    }
   ],
   "source": [
    "value = input(\"请输入一个数值: \")\n",
    "\n",
    "# 第一层\n",
    "if value.isdigit():\n",
    "    number = int(value)\n",
    "    \n",
    "    # 第二层\n",
    "    if 0 <= number <= 100:\n",
    "        \n",
    "        # 第三层\n",
    "        if number < 60:\n",
    "            print(\"不及格\")\n",
    "        else:\n",
    "            print(\"及格\")\n",
    "        # 第三层结束\n",
    "    \n",
    "    else:\n",
    "        print(\"数值不在0~100之间\")\n",
    "    # 第二层结束\n",
    "    \n",
    "else:\n",
    "    print(\"输入的不是一个数值\")\n",
    "# 第一层结束"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.9"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
